from appium import webdriver
import time

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '5.1.1'
desired_caps['deviceName'] = '127.0.0.1:62001'
# desired_caps['appPackage'] ='com.youba.calculate'
# desired_caps['appActivity'] ='.MainActivity'
desired_caps['noReset'] = True
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)



#driver.reset()  重置qq阅读

# sy = driver.contexts
#print(sy)  获取可用上下文

#sx = driver.current_context
# print(sx) 获取当前上下文

#print(driver.switch_to.context('WEBVIEW_1'))  切换上下文